Honor control-plane tool name aliases - #56
Merged
Conversation
The gateway namespaced federated tools as {backend}-{raw_name}, which
diverges from the control plane's naming for the same virtual server
whenever the upstream tool name contains non-slug characters (e.g.
get_stats vs fast-time-get-stats). Slugify the tool part when
advertising and map it back to the upstream's original name on
tools/call via the backend's published allowed_tool_names, so clients
see identical names on both planes.
Signed-off-by: lucarlig <luca.carlig@ibm.com>
cp_slug approximated the control plane's slugify for ASCII only, so tool names containing accents, contractions, or other non-ASCII characters would diverge between the planes. Port the full algorithm in the control plane's order — unicode lowercase, contraction apostrophe removal, non-word runs to single trimmed hyphens, the ae/ss/o special-character map, NFKD decomposition keeping ASCII — with test vectors generated from mcpgateway.utils.create_slug.slugify, including the dropped-prefix separator behavior for undecomposable characters. Signed-off-by: lucarlig <luca.carlig@ibm.com>
Signed-off-by: lucarlig <luca.carlig@ibm.com>
8 tasks
Signed-off-by: lucarlig <luca.carlig@ibm.com>
Signed-off-by: lucarlig <luca.carlig@ibm.com>
Signed-off-by: lucarlig <luca.carlig@ibm.com>
dawid-nowak
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The gateway previously derived federated tool names by reimplementing control-plane slugification. The corrected control-plane contract publishes the exact protocol-visible custom name plus its upstream original name, so local slugification loses valid casing, dots, and underscores and duplicates naming policy.
Summary
tool_name_aliasesmapping published by the control plane{backend-id}-{tool}advertisement and routing for older configs without aliasesPairs with IBM/mcp-context-forge#5553, which publishes UUID-keyed backends and
{exposed_name: original_name}aliases for virtual-server tools.Validation
cargo test -p contextforge-gateway-rs-apiscargo test -p contextforge-gateway-rs-libcargo clippy -p contextforge-gateway-rs-apis --all-targets -- -D warningscargo clippy -p contextforge-gateway-rs-lib --all-targets -- -D warningscargo fmt --all -- --check